<template>
  <div>
    <div class="community">
    <van-list
      v-model:loading="state.loading"
      :finished="state.finished"
      @load="onLoad"
      id="ul"
      finished-text="没有更多了"
    >
      <div
          class="video-item"
          v-for="item in state.commlist"
          v-bind:key="item.comment_id"
        >
          <router-link :to="{name:'comminside',params:{id:item.comment_id}}">
            <van-image width="100%" height="63.46vw" :src="item.img" />
            <div class="video-text">
              <p class="goods-name">
                {{ item.goods_name }}
              </p>
              <div class="video-info">
                <div class="video-name">
                  <van-image
                    class="user_picture"
                    round
                    width="22px"
                    height="22px"
                    :src="item.user_picture"
                  />
                  <span>{{ item.user_name }}</span>
                </div>
                <div class="video-span">
                  <van-icon class="eye" name="eye-o" />
                  <span class="size">{{ item.dis_browse_num }}</span>
                </div>
              </div>
            </div>
          </router-link>
        </div>
    </van-list>
    </div>
    
  </div>
</template>
<script>
import { reactive } from "vue";
import store from "../../store/index.js";
// import route from "../../router/index.js"


export default {
 
  setup() {
    const state = reactive({
      commlist: [],
      loading: false,
      finished: false,
      size: 10,
      page: 1,

    });

    const onLoad = () => {
      store
        .dispatch({
          type: "getFindCommlist",
          size: state.size,
          page: state.page,
        })
        .then((data) => {
          state.commlist = data;
          state.page=state.page+1
          state.loading=true
          state.finished=true
        });
        
    };

    return {
      state,
      onLoad,
    };
  },
};
</script>

<style lang="less" scoped>
* {
  margin: 0;
  padding: 0;
}
.community {
  padding: 10px 7px 0 7px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 51px;
  #ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    .video-item {
      width: 168.656px;
      height: 331.45px;
      border-radius: 1rem;
      background-color: #fff;
      overflow: hidden;
      margin-top: 10px;
      .video-img {
        width: 168.66px;
        height: 228.45px;
      }
      .goods-name {
        font-size: 15px;
        font-weight: 500;
        color: #333;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
      }
      .video-info {
        display: flex;
        justify-content: space-between;
        margin-top: 10px;
        .video-name {
          display: flex;
          .user_picture {
            margin-right: 5px;
          }
          span {
            // height: 22px;
            width: 75px;
            display: inline-block;
            font-size: 12px;
            color: #333;
            line-height: 22px;
          }
        }
        .video-span {
          font-weight: 400;
          font-size: 12px;
          color: #333;
          line-height: 22px;
          // margin-right: 10px;
          .eye {
            font-size: 16px;
          }
        }
      }
    }
  }
  .video-text {
    padding: 10px 10px 16px 10px;
  }
}
.footer-cont {
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 3;
  font-weight: 400;
  color: #888;
  font-size: 16px;
  margin-bottom: 51px;
}
</style>